
package com.yuan.servlet;

import com.yuan.hibernate.员工活动轨迹表;
import com.yuan.hibernate.员工活动轨迹表DAO;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class gettrailservlet extends BaseHttpServlet {
    private 员工活动轨迹表DAO m员工活动轨迹表DAO = null;
    @SuppressWarnings("rawtypes")
    private List<Map> anList;
    private List<员工活动轨迹表> mList;

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        super.doGet(request, response);
        String data = request.getParameter("data");
        int id = Integer.parseInt(request.getParameter("id"));
        m员工活动轨迹表DAO = new 员工活动轨迹表DAO();
        mList = m员工活动轨迹表DAO.findBy序号(id);
        anList = new ArrayList();
        Map<String, String> map = null;
        try {
            for (员工活动轨迹表 temp : mList) {

                if (temp.get时间().startsWith(data))
                {
                    map = new HashMap<String, String>();
                    map.put("data", temp.get时间().trim());
                    map.put("lng", temp.getLng().toString());
                    map.put("lat", temp.getLat().toString());
                    anList.add(map);
                    mResponse = com.yuan.util.JsonUtils.getFromList(anList);
                }
            }
        } catch (Exception e)
        {
            mResponse = "输入异常";
            e.printStackTrace();
        }
        closeAndClear();
    }

    protected synchronized void closeAndClear() {
        m员工活动轨迹表DAO = null;
        anList = null;
        mList = null;
        super.closeAndClear();
    }
}
